package com.ljlobserv.demo.dao;

import com.ljlobserv.demo.entity.User;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName：UserDaoImpl
 * Description：
 * Create by Administrator
 * Date：2020/8/25 0025 10:24
 */
public class UserDaoImpl implements UserDao {
    private List<User> list = new ArrayList<User>();
    private long id = 1;


    List<User> userList = new ArrayList<User>();

    public void registerUser() {
        User user = new User();
        user.setAddress("广州"+id);
        user.setAge((int) (19+id));
        user.setId(id);
        user.setName("张三"+id);
        user.setRemake("备注"+id);
        user.setSex("性别"+id);
        list.add(user);
        id++;

    }

    public void logoutUser(long id) {
        for (int i = 0; i < list.size(); i++) {
            User user = list.get(i);
            if(user.getId() == id){
                list.remove(i);
            }
        }
    }
}
